import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/index/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/user/info',
    method: 'get',
    params: { token }
  })
}

export function update(data) {
  return request({
    url: '/admin/user/edit',
    method: 'post',
    data
  })
}

export function modify(data) {
  return request({
    url: '/admin/user/modify',
    method: 'post',
    data
  })
}

export function fetchList(query) {
  return request({
    url: '/admin/user/index',
    method: 'get',
    params: query
  })
}

export function userDisable(data) {
  return request({
    url: '/admin/user/disable',
    method: 'post',
    data
  })
}

export function userEnable(data) {
  return request({
    url: '/admin/user/enable',
    method: 'post',
    data
  })
}

export function createUser(data) {
  return request({
    url: '/admin/user/add',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/admin/user/edit',
    method: 'post',
    data
  })
}

export function resetPassword(data) {
  return request({
    url: '/admin/user/resetPassword',
    method: 'post',
    data
  })
}

export function delUser(data) {
  return request({
    url: '/admin/user/del',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/admin/index/logout',
    method: 'post'
  })
}
